package com.android.kotlin

import android.util.ArrayMap
import org.junit.Test
import java.util.*
import kotlin.collections.HashMap

/**
 * @Description:
 * @Author: xuwenlong
 * @Email: xuwenlong @ebrun.com
 * @Version:
 * @Create: 2019/2/25 0025
 * @Modify:
 */


class ListTest{

    @Test
    fun myTest1(){
        var myList=listOf<Int>(3,6,29,44,60)
//        myList.forEach { print(it) }
        myList.filter { it>30 }.map { it+1 }.forEach { println(it) }

        val u1=User("aa")
        val u2=User("bb")
        val u3=User("cc")

        val users= Arrays.asList(u1,u2,u3)
        val map:Map<String,String> =ArrayMap<String,String>()

        Collections.sort(users){
            u1,u2 -> u2.name.compareTo(u1.name)
        }

        Thread{
            users.forEach { println(it.name) }
        }.start()

        var base =Base();
        var child=User("aa");

        executeFoo(base)

    }
    fun executeFoo(base: Base) = base.getText()

    class User(var name:String):Base(){


        override fun getText() {
            println("我是子类")
        }
    }

    open class  Base{

        open fun getText(){
            println("我是父类")
        }
    }
}